﻿using Missbot.Common;
using Newtonsoft.Json;

namespace Missbot.Model.MsgInfos
{
    public class InstanceUser
    {
        [JsonProperty("host")]
        public string Host { get; set; }
        
        [JsonProperty("id")]
        public string ID { get; set; }
        
        [JsonProperty("username")]
        public string UserName { get; set; }
        
        [JsonProperty("name")]
        public string Name { get; set; }
        
        [JsonProperty("isBot")]
        public bool IsBot { get; set; }
        
        [JsonProperty("isAdmin")]
        public bool IsAdmin { get; set; }
        
        [JsonProperty("isFollowing")]
        public bool IsFollowing { get; set; }
        
        [JsonProperty("hasPendingFollowRequestFromYou")]
        public bool HasPendingFollowRequestFromYou { get; set; }

        public bool IsLocalUser => Host == Configger<AIConfigBase>.AIConfig.Instance.LocalHost || string.IsNullOrEmpty(Host);

        public string FullUserName => IsLocalUser ? UserName : $"{UserName}@{Host}";
    }
}